package com.violet.controller.app;

import com.violet.domain.result.Result;
import com.violet.domain.result.ResultPage;
import com.violet.domain.search.MyPage;
import com.violet.domain.vo.app.AOrderVo;
import com.violet.service.app.AWaitReceivingOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/app/order/wait_receiving")
@RequiredArgsConstructor
public class AWaitReceivingOrderController {

    private final AWaitReceivingOrderService service;

    // 分页获取配送中订单
    @GetMapping
    public ResultPage<List<AOrderVo>> getWaitReceivingOrders(@ModelAttribute MyPage myPage) {
        return service.getWaitReceivingOrders(myPage);
    }

    // 对配送中的订单确认收货
    @PutMapping("/{id}")
    public Result<Boolean> confirmReceivingOrder(@PathVariable String id) {
        return Result.success(service.confirmReceivingOrder(id), "确认收货");
    }

}
